export class DialogController {
  params;
  dialog;
  store;
  currentDialogStore;
  constructor(store) {
    this.store = store;
  }
  setDialogParams(params){
    this.params=params
  }
  setCurrentDialogStore(dialogStore){
      this.currentDialogStore=dialogStore
  }
  openDialog (dialogKey, triggerSourceKey, data) {
    console.log(dialogKey, triggerSourceKey, data);
    let dialog = this.store.root.blackList.find((item) => {
      return item.key == dialogKey;
    });
    dialog.options.dialogVisible = true;
    dialog.options.triggerSourceKey = triggerSourceKey;
    dialog.params=this.params
    this.dialog=dialog
  }
  submit(){
   return new Promise((resolve)=>{
      alert("弹框内表单提交")
      resolve()
    })
  }
  getDialog () {
    let _this=this
    let dialogModel={
     form: _this.currentDialogStore.models,
     selector: _this.currentDialogStore.selector,
     submit:_this.submit.bind(_this)
    }
    return dialogModel
  }
}
